package DesignPattern.singleton;

/**
 * 双重锁校验
 *
 * @author Administrator
 *
 */
public class singletonDemo4 {
	private volatile static singletonDemo4 instance;

	private singletonDemo4() {
		System.out.println("singleton has load");
	}

	public static singletonDemo4 getInstance() {
		if (instance == null) {
			synchronized (singletonDemo4.class) {
				if (instance == null) {
					instance = new singletonDemo4();
				}
			}
		}
		return instance;
	}

}
